package com.dsx.myblog.web;

import io.swagger.annotations.ApiOperation;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * @author dsx
 */
@Controller
public class PageController {

    @ApiOperation(value="跳转到后台首页", notes="")
    @GetMapping(value = {"/admin", "/admin/index.html"})
    public String index(){
        return "admin/dashboard";
    }


    @ApiOperation(value="跳转到后台首页", notes="")
    @GetMapping(value = {"/admin/test"})
    public String ccTest(){
        return "admin/test";
    }


    @ApiOperation(value="跳转到用户管理页", notes="")
    @GetMapping(value = {"/admin/users"})
    public String users(){
        return "admin/user";
    }

    @ApiOperation(value="跳转到用户编辑页", notes="")
    @GetMapping(value = {"/admin/users/edit/{id}"})
    public String editUser(@PathVariable Long id){
        return "admin/user_edit";
    }
    @ApiOperation(value="跳转到添加用户页", notes="")
    @GetMapping(value = {"/admin/users/add"})
    public String addUser(){
        return "admin/user_edit";
    }

    @ApiOperation(value="跳转到文章管理页", notes="")
    @GetMapping(value = {"/admin/articles"})
    public String article(){
        return "admin/article";
    }

    @ApiOperation(value="跳转到文章编辑页", notes="")
    @GetMapping(value = {"/admin/articles/edit/{id}"})
    public String editArticle(@PathVariable Long id){
        return "admin/article_edit";
    }
    @ApiOperation(value="跳转到添加文章页", notes="")
    @GetMapping(value = {"/admin/articles/add"})
    public String addArticle(){
        return "admin/article_edit";
    }

    @ApiOperation(value="跳转到显示文章页", notes="")
    @GetMapping(value = {"/fore/blog/{id}"})
    public String articleDetail(@PathVariable long id){
        return "fore/blog";
    }
}
